<?php
/**
 * YQueueDatabaseFactory.php
 *
 * @author Hua Yang <htmlcook@gmail.com>
 * @since 2.0
 */

Yii::import('common.components.queue.YDatabaseQueue');

/**
 * Class YQueueDatabaseFactory
 */
class YQueueDatabaseFactory extends CApplicationComponent
{
	/**
	 * @var CDbConnection
	 */
	protected $db;

	public function init()
	{
		parent::init();
		$this->db = Yii::app()->getDb();
	}

	/**
	 * @param $name
	 * @return YDatabaseQueue
	 */
	public function get($name)
	{
		return new YDatabaseQueue($name, $this->db);
	}
} 